<?php

declare(strict_types=1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class AdminRole extends Model
{
    /**
     * 更新 function
     *
     * @param array|object $data
     * @param array $where
     * @param array $allowField
     * @param string $suffix
     * @return void
     */
    public static function update(
        array|object $data,
        $where = [],
        array $allowField = [],
        string $suffix = ''
    ) {
        foreach (['create_time', 'update_time', 'delete_time'] as $field) {
            if (isset($data[$field]) && is_string($data[$field])) {
                $data[$field] = strtotime($data[$field]);
            }
        }
        return parent::update($data, $where, $allowField, $suffix);
    }
}
